package com.hznu.jspFinal.service;

import com.hznu.jspFinal.dao.CourseTeacherMapper;
import com.hznu.jspFinal.entity.CourseTeacher;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * author:wp
 */
@Service
public class CourseTeacherServiceImpl implements CourseTeacherService{
    @Autowired
    private CourseTeacherMapper courseTeacherMapper;

    @Override
    public int addOne(CourseTeacher courseTeacher) {
        return courseTeacherMapper.insertSelective(courseTeacher);
    }

    @Override
    public int delete(Integer id) {
        return courseTeacherMapper.deleteByPrimaryKey(id);
    }

    @Override
    public CourseTeacher findById(Integer id) {
        return courseTeacherMapper.selectByPrimaryKey(id);
    }

    @Override
    public List<CourseTeacher> findByTeacherid(Integer teacherid) {
        return courseTeacherMapper.selectByTeacherid(teacherid);
    }

    @Override
    public int update(CourseTeacher courseTeacher) {
        return courseTeacherMapper.updateByPrimaryKeySelective(courseTeacher);
    }

    @Override
    public List<CourseTeacher> selectByCourseIdAndTeachId(Integer courseid, Integer teacherid) {
        return courseTeacherMapper.selectByCourseIdAndTeachId(courseid,teacherid);
    }
}
